
<%@page import="org.w3c.dom.NodeList"%>
<%@page import="org.w3c.dom.Element"%>
<%@page import="java.io.InputStream"%>
<%@page import="java.net.URL"%>
<%@page import="org.w3c.dom.Document"%>
<%@page import="java.io.File"%>
<%@page import="javax.xml.parsers.DocumentBuilder"%>
<%@page import="javax.xml.parsers.DocumentBuilderFactory"%>
<%
	/**
	 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
	 *
	 * This library is free software; you can redistribute it and/or modify it under
	 * the terms of the GNU Lesser General Public License as published by the Free
	 * Software Foundation; either version 2.1 of the License, or (at your option)
	 * any later version.
	 *
	 * This library is distributed in the hope that it will be useful, but WITHOUT
	 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
	 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
	 * details.
	 */
%>

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />

<portlet:renderURL var="showEventosURL">
				<portlet:param name="jspPage" value="/view.jsp"/>
</portlet:renderURL>
<h1 style="border-bottom: 2px dotted #ccc;">Eventos</h1>	
<div style="width: 100%; text-align: right;">
<a href="<%= showEventosURL %>"><img src="/image-proxy/btn_back.png"/></a>
</div>
<%


DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(false);
DocumentBuilder docBuilder = dbf.newDocumentBuilder();

URL eventoURL = new URL("http://10.52.152.2/eventos/eventos/" +
		renderRequest.getParameter("eventoId") + ".xml");
InputStream isEvento = eventoURL.openStream();

Document docEvento = docBuilder.parse(isEvento);
Element eventoTag = docEvento.getDocumentElement();


URL fotosURL = new URL("http://10.52.152.2/eventos/fotos.xml?evento_id=" +
		renderRequest.getParameter("eventoId"));
InputStream isFotos = fotosURL.openStream();

Document docFotos = docBuilder.parse(isFotos);
Element fotosTag = docFotos.getDocumentElement();
NodeList fotosTags = fotosTag.getElementsByTagName("foto");
%>
<p>
	<h2><%= eventoTag.getElementsByTagName("titulo").item(0).getTextContent() %></h2>
</p>
<p>
<%= eventoTag.getElementsByTagName("texto").item(0).getTextContent() %>
</p>
<%
for (int i = 0; i <fotosTags.getLength(); i++) {
	Element fotoTag = (Element) fotosTags.item(i);
%>
	<img src="/image-proxy/eventos/fotos/<%= fotoTag.getElementsByTagName("id").item(0).getTextContent() %>.jpg"
		/>
<%
}
%>
<div style="width: 100%; text-align: right;">
<a href="<%= showEventosURL %>"><img src="/image-proxy/btn_back.png"/></a>
</div>